package com.medata.service.impl;

import com.medata.dataObject.BlackListForIp;
import com.medata.repository.BlackListForIpRepository;
import com.medata.service.BlackListForIpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

/**
 * @author ：zb
 * @date ：Created in 2019/3/26 0026 9:19
 * @description：
 */
@Service
public class BlackListForIpServiceImpl implements BlackListForIpService {
    @Autowired
    private BlackListForIpRepository blackListForIpRepository;


    @Override
    public List<BlackListForIp> findAll() {
        List<BlackListForIp> all = blackListForIpRepository.findAll();
        return all;
    }

    @Override
    @Transactional
    public void deleteByBlackIp(String ip) {
        blackListForIpRepository.deleteByBlackIp(ip);
    }

    @Override
    public Page<BlackListForIp> findAll(Pageable pageable) {
        return blackListForIpRepository.findAll(pageable);
    }
}
